/*  This file is part of the comicconquer project
    Copyright (C) 2010 Reach <reach334@gmail.com>

    ComicConquer is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This software is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public 
    License along with this software.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef COLISTWIDGET_H
#define COLISTWIDGET_H

#include "mist.h"
#include "onyx/ui/tree_view.h"

/**
 * The item of CoListWidget. Include a string and an identity.
 * 
 * @author reach (5/25/2010)
 */
struct CoListItem
{
    CoListItem(const QString& instr, const int inid)
    {
        str = instr;
        id = inid;
    }

    CoListItem(){}

    QString str;
    int id;
};
typedef QVector<CoListItem> CoListItems;

/**
 * The list widget inheriting OnyxTreeView.
 * 
 * @author reach (5/25/2010)
 */
class CoListWidget : public ui::OnyxTreeView
{
    Q_OBJECT

    //-- constructor
public:
    CoListWidget(CoListItems* items, QWidget* parent = 0);

    //-- public methods
public:
    CoListItem* getListItem(int id);
    void setListItems(CoListItems* items);

    //-- private members
private:
    QStandardItemModel m_model;
    CoListItems* m_listItems;

};

#endif // COLISTWIDGET_H
